package com.manytory.torycoupon;

import com.manytory.torycoupon.data.ToryCoupon_App;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;

public class IntroActivity extends Activity{

	final Handler mHandler = new Handler();
	final Runnable LuanchTask = new Runnable() {
		public void run() {
			if(ToryCoupon_App.nAuthState == 100)
				startActivity(new Intent(IntroActivity.this, AuthRegActivity.class));
			else if(ToryCoupon_App.nAuthState == 200)
				startActivity(new Intent(IntroActivity.this, MainTabActivity.class));
			else
				startActivity(new Intent(IntroActivity.this, ClauseActivity.class));
		}
	};
	
	@Override
	public void onBackPressed() {
		mHandler.removeCallbacks(LuanchTask);
		
		super.onBackPressed();
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.intro_layout);
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		mHandler.postDelayed(LuanchTask, 2000);
	}

}
